import { BasicClassValueField } from "@@/apis/basic-data/types"
import { ModelPageRequestData, PageRequestData, ResponseTableData, TableData } from "@@/apis/common"
import { ModelType } from "@@/constants/other-keys"

export interface ComponentTableData {
  code: string
  description: string
  id: string
  name: string
}

export interface ModelInfo {
  // 唯一标识
  id?: string
  // 实体id
  entityId?: string
  // 模型类型
  modelType?: ModelType
  // 标签
  label?: string
  // 采样率
  samplingRate?: string
  // 组件模型
  functionId?:string
}

export interface ModelDetailInfo {
  typing: ModelInfo
  values: BasicClassValueField[]
}

export interface EntityViewInfo {
  entity: EntityBaseInfo
  entityType: SevenCode
  entityTypeText: SevenCodeText
  typings: ModelInfo[]
  files: any
}

export interface SevenCode {
  kind: number
  domain: number
  country: number
  category: number
  subcategory: number
  specific: number
  extra: number
}

export interface SevenCodeText {
  kind: string
  domain: string
  country: string
  category: string
  subcategory: string
  specific: string
  extra: string
}

export interface EntityBaseInfo {
  id: string | undefined
  code: string
  name: string
  tag: string[] | string
  description: string
  milstdId: string
  threeId: string
  milstdPath?: string
  threeThumbPath?: string
  threePath?: string
  sevenCode?: string
  entityType: SevenCode
}

export interface TableRequestData {
  /** 实体名称 */
  code?: string
  /** 国别/地区 */
  country?: string
}

export interface EntityTableData extends EntityBaseInfo, TableData {
  id: string,
  sevenCode: string,
  name: string,
  entityId: string,
}
export interface PageTableRequestData extends TableRequestData, ModelPageRequestData {
  tags: string[]
}
export interface SevenCodeItem {
  id: string
  value: number
  name: string
  type: string
  applicability: string
}

export type SearchEntityTableResponseData = ApiResponseData<ResponseTableData<EntityTableData>>
export type EntityListResponseData = ApiResponseData<EntityTableData[]>
export type EntityInfoResponseData = ApiResponseData<EntityBaseInfo>
export type EntityViewInfoResponseData = ApiResponseData<EntityViewInfo>
export type ModelViewInfoResData = ApiResponseData<ModelDetailInfo>
export type ComponentResData = ApiResponseData<ComponentTableData[]>
export type ComponentFieldResData = ApiResponseData<BasicClassValueField[]>
export type SevenCodeResData = ApiResponseData<SevenCodeItem[]>
